package personal.service.accounting;

import java.util.List;

import personal.dao.support.TransactionSearchCriteria;
import personal.domain.accounting.ExpenseTransaction;
import personal.domain.accounting.IncomeTransaction;
import personal.domain.accounting.TransferTransaction;


public interface TransactionService {
	/**
	 * Adds an expense transaction and adjusts corresponding account month end balances and income expense category monthly total.
	 * @param transaction. Expense transaction to be saved.
	 * @return ExpenseTransaction with generated transaction id.
	 */
	public ExpenseTransaction addExpenseTransaction(ExpenseTransaction transaction);
	/**
	 * Deletes an expense transaction and adjusts corresponding account month end balances and income expense category monthly total.
	 * @param transaction. Expense transaction to be deleted.
	 */
	public void deleteExpenseTransaction(ExpenseTransaction transaction);
	/**
	 * Adjust one or both of transaction amount and transaction date (day, month, year) of an expense transaction. Adjusts corresponding 
	 * account month end balances and income expense category monthly total.
	 * @param transaction. Expense transaction to be adjusted.
	 */
	public void adjustExpenseTransaction(ExpenseTransaction transaction);
	/**
	 * Finds expense transactions matching search criteria
	 * @param criteria - TransactionSearchCriteria. Populate at least year of monthwise calendar
	 * @return - List<ExpenseTransaction> - List of matching expense transactions
	 */
	public List<ExpenseTransaction> getExpenseTransactions(TransactionSearchCriteria criteria);
	/**
	 * Adds an income transaction and adjusts corresponding account month end balances and income expense category monthly total.
	 * @param transaction. Income transaction to be saved.
	 * @return IncomeTransaction with generated transaction id.
	 */
	public IncomeTransaction addIncomeTransaction(IncomeTransaction transaction);
	/**
	 * Deletes an income transaction and adjusts corresponding account month end balances and income expense category monthly total.
	 * @param transaction. Income transaction to be deleted.
	 */
	public void deleteIncomeTransaction(IncomeTransaction transaction);
	/**
	 * Adjust one or both of transaction amount and transaction date (day, month, year) of an income transaction. Adjusts corresponding 
	 * account month end balances and income expense category monthly total.
	 * @param transaction. Income transaction to be adjusted.
	 */
	public void adjustIncomeTransaction(IncomeTransaction transaction);
	/**
	 * Finds income transactions matching search criteria
	 * @param criteria - TransactionSearchCriteria. Populate at least year of monthwise calendar
	 * @return - List<ExpenseTransaction> - List of matching income transactions
	 */
	public List<IncomeTransaction> getIncomeTransactions(TransactionSearchCriteria criteria);
	/**
	 * Adds a transfer transaction and adjusts corresponding to and from account month end balances.
	 * @param transaction. Transfer transaction to be saved.
	 * @return TransferTransaction with generated transaction id.
	 */
	public TransferTransaction addTransferTransaction(TransferTransaction transaction);
	/**
	 * Deletes a transfer transaction and adjusts corresponding to and from account month end balances.
	 * @param transaction. Transfer transaction to be deleted.
	 * @return TransferTransaction with generated transaction id.
	 */
	public void deleteTransferTransaction(TransferTransaction transaction);
	/**
	 * Adjust one or both of transaction amount and transaction date (day, month, year) of an transfer transaction. Adjusts corresponding 
	 * to and from account month end balances.
	 * @param transaction. Transfer transaction to be adjusted.
	 */
	public void adjustTransferTransaction(TransferTransaction transaction);
	/**
	 * Finds transfer transactions matching search criteria
	 * @param criteria - TransactionSearchCriteria. Populate at least year of monthwise calendar
	 * @return - List<ExpenseTransaction> - List of matching transfer transactions
	 */
	public List<TransferTransaction> getTransferTransactions(TransactionSearchCriteria criteria);
}
